/**
 * 
 */
package action.member;

import org.apache.struts2.ServletActionContext;

import model.MMember;
import service.interf.IMember;
import action.common.MyBaseAction;

import com.opensymphony.xwork2.ModelDriven;
import common.interf.IErrorHandle;

/**
 * 编辑会员
 * @author 鄢倩
 * 2013-1-16
 */
public class MemberEditAction  extends MyBaseAction<MMember> implements
ModelDriven<MMember>{

	private IMember iMember;
	private IErrorHandle iErrorHandle;
	
	public void setIMember(IMember iMember) {
		this.iMember = iMember;
	}
	
	public MemberEditAction() {
		super(MMember.class);
	}

	@Override
	public MMember getModel() {
		return model;
	}
	
	public void add() {
		String s = "";
		try {
			s = iMember.addMember(model);
		} catch(Exception e) {
			s = iErrorHandle.handleErr(e);
		}
		servletHandle.writeToClient1(ServletActionContext.getResponse(),s);
	}
	
	public void find() {
		String s = "";
		try {
			s = iMember.findByMemberId(model.getMemberId());
		} catch (Exception e) {
			s = iErrorHandle.handleErr(e);
		}
		servletHandle.writeToClient(ServletActionContext.getResponse(),s);
	}

}
